-
Notifications
You must be signed in to change notification settings - Fork 8
First draft at adding support for conjugate.
#63
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
|
This PR is ready to merge. Currently the conjugate tests are only run on the reference backend and oneMKL. Once we add conjugate support to the other backends, we can enable the tests for them. Some tests are failing on cuSPARSE and rocSPARSE, but this PR doesn't touch any related code, so I think that is unrelated. It might be an issue with the machines the self-hosted runners are on. |
| if (__detail::is_conjugated(a) || __detail::is_conjugated(b) || | ||
| __detail::is_conjugated(c)) { | ||
| throw std::runtime_error( | ||
| "aoclsparse backend does not support conjugated views."); | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ok, so here is a design question it seems like we should have the following checks:
not transposed + not conjugate == is_nontransposed
not transposed + conjugate == is_conjugated
transposed + not conjugate == is_transposed
transposed + conjugate == is_conjugate_transposed
MKL and AOCL and other libraries support nontranspose/transpose/conjugatetranspose but not conjugate. in the is_conjugated() function do we need to rule out is_transposed() so we can correctly capture conjugate_transpose ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nevermind, it just hasn't been implemented yet here. see mkl backend for actual implementation.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
User Data: input is CSR
csr_view<I,O,T>csrV(/* user data in csr */);
matrix_handle csrA(csrV);
sparse::spmv(transposed(csrA), x,y) // y = A^T * x
sparse::spmv(conjugated(transposed(csrA)), x,y) // y = A^H * x
sparse::spmm(csrA,W,Z) // Z = A*W
converts to in MKL backend
mkl::sparse::matrix_handle_t csrA;
mkl::sparse::set_csr_data(csrA, /* user data */)
mkl::sparse::gemv(csrA, transpose::trans, x,y)
mkl::sparse::gemv(csrA, transpose::conjtrans, x,y)
mkl::sparse::gemm(csrA, transpose::nontrans, W, Z)
• Implemented conjugated support alongside scaled with a new conjugated_view and inspector logic to detect
conjugated inputs. Reference backend now conjugates values via std::conj, while vendor backends either
apply conjugate-transpose where supported (oneMKL CSC) or throw when conjugated views are passed. Added
complex-number SpMV tests for conjugated A and B.
Testing: